﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TicTacToe
{
    public class AI
    {
        public bool play(char[,] m)
        {
            bool computerdone = false;
            Random r = new Random();
            while (!computerdone)
            {
                int ax = r.Next(0, 3);
                int ay = r.Next(0, 3);

                if ((m[ax, ay] != 'X') && (m[ax, ay] != 'O'))
                {
                    m[ax, ay] = 'O';
                    Console.WriteLine("Computer move " + ax + "," + ay);
                    computerdone = true;
                }
            }
            return computerdone;
        }
    }
}
